home *** CD-ROM | disk | FTP | other *** search
- The text that follows describes how to set Keystroke to perform a routine for the stripping out of
- carriage returns from preformatted text as requested by Archive reader Stuart Bell.
-
- The series of actions we need to tell Keystroke to get Edit to perform is to convert all double CRs
- (Carriage Returns) to ZXZ, then convert all remaining single CRs to a single space, any double
- spaces are then converted to a single space, then finally convert all ZXZ letter groups back to CRs
- again.
-
- The text we are going to convert in this example is the !Help text file that is held within your
- !System application. Open your copy of !System and backup this file before we start tampering with
- it!
- Load the text file into your copy of !Edit and look at it. The text is preformatted at 50 characters a
- line which is fine for reading in a text editor, but not so good for using within a word or DTP
- processor.
-
- I've assumed at this point that you have the text file in Edit, and you have a copy of Keystroke
- loaded ready for setting up.
-
- First choose a key combination to activate the actions that Keystroke will be asked to perform.
- I have chosen Alt+Q for this example.
-
- Action 1
- Key : Alt+ Q
- Keystroke type: Insert text
- Text: \C-⇧\\F4\
- This action will force the caret within Edit to the top left and then pop up its Find text window.
- The reason for moving the caret is that Edit only performs its search & replace operations from the
- caret position. By forcing it to the beginning we can be certain it will operate on all the text.
-
- Action 2
- Key : Alt+Q
- Keystroke type: Icon click
- Window option: Any window
- Match option: Must match details
- Click type: Select, Single, Switch On
- Drag to set: The 'Magic characters' icon in the 'Find text' window of
- Edit
- Note : You'll need to use the two shift keys to set Keystroke.
- Link : On
- This action performs a single Select type mouse click on the icon called 'Magic characters' held
- within Edit's find text window and forces it to be switched on.
- (Normally you drag the 'Drag to set' icon from Keystroke to the icon or window concerned. But
- these particular Edit windows will close immediately if you try this, so use Keystrokes alternative
- way of setting it by positioning the mouse pointer to the icon in Edit and press the two shift keys at
- the same time.)
-
- Action 3
- Key : Alt+Q
- Keystroke type: Insert text
- Text: \\n\\n\⇩\ZXZ|M
- Link : On
- This action enters '\n\n' within the Find: box. This is the required two CRs. Then \⇩\ which is a
- cursor down command. The caret is now in the 'Replace with: box, so Keystroke now enters 'ZXZ'
- followed by a '|M' which starts the search and replace operation off.
-
- Action 4
- Key : Alt+Q
- Keystroke type: Icon click
- Window option: Any window
- Match option: Must match details
- Drag to set: On the 'End of File replace' icon in the 'Text found:'
- window
- Note : You'll need to use the two shift keys to set Keystroke.
- Click type: Select, Single, Toggle
- Link : On
- This action will click on the End of File replace icon to perform the search and replace on ALL
- occurrences found. ( Risc PC owners and users of !Newlook will find that this window is named
- 'Text found')
-
- Action 5
- Key : Alt+Q
- Keystroke type: Insert text
- Text: |[\C-⇧\\F4\\\n\⇩\ |M
- Link : On
- This action first closes the 'Text found: window by simulating an 'Escape' key being pressed (|[),
- then as before the cursor is placed back to the beginning of the text and the 'find text' window
- popped up by 'F4'.
- A CR, '\n', is entered in the 'Find' box and a single space is entered in the 'Replace with:' box and
- the '|M' sets the search and replace off.
-
- Action 6
- The same as Action 4.
- This action will click on the 'End of file replace' icon to perform the search and replace on ALL
- occurrences found.
-
- Action 7
- Key : Alt+Q
- Keystroke type: Insert text
- Text: |[\C-⇧\\F4\ \⇩\ |M
- Link : On
- As before the 'Text found: window is closed by simulating an 'Escape' key being pressed (|[), then
- the cursor is placed back to the beginning of the text and the 'find text' window popped up by 'F4'.
- This time a double space is entered in the 'Find' box and a single space is entered in the 'Replace
- with:' box and the '|M' sets the search and replace off.
-
- Action 8
- The same as Action 4.
- This action will click on the 'End of file replace' icon to perform the search and replace on ALL
- occurrences found.
-
- Action 9
- Key : Alt+Q
- Keystroke type: Insert text
- Text: |[\C-⇧\\F4\ZXZ\⇩\\\n|M
- Link : On
- As before the 'Text found: window is closed by simulating an 'Escape' key being pressed (|[), then
- the cursor is placed back to the beginning of the text and the 'find text' window popped up by 'F4'.
- This time the letters 'ZXZ' are entered in the 'Find' box and a single '\n' (CR) is entered in the
- 'Replace with:' box and the '|M' sets the search and replace off.
-
- Action 10
- The same as Action 4.
- This action will click on the 'End of file replace' icon to perform the search and replace on ALL
- occurrences found.
-
- Action 11
- Key : Alt+Q
- Keystroke type: Insert text
- Text: |[\F3\
- Link : On
- The 'Text found:' window is closed once again (|[) and the text has now been de-formatted, ready
- to save. So '\F3\' performs a F3 command and up pops Edit's Save dialogue window!
-
- Last point.
- You will have noticed that the Link option has been set on for each action. The reason for this is that
- if one individual action did fail to operate for some reason (perhaps the user had accidentally closed
- the Edit text window) then the whole sequence will stop. The individual actions having been 'linked'
- together as one whole group.
-
- Owners of Keystroke should examine their keystrokes Archive directory that we supply with
- Keystroke. Within it you'll find a directory called 'RetrnStrip'. This provides a bigger and better
- example of this type of search and replace operation with Edit.
-
-
- By Stuart Halliday
-
-
-
- © Quantum Software 1995
-